﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MacroStudentReport.aspx.cs" Inherits="ExamAnalysis.Reports.MacroStudentReport" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        var percent = function (value) {
            return value + "%";
        };

        var submitValue = function (grid, hiddenFormat, format) {
            hiddenFormat.setValue(format);
            grid.submitData(false, { isUpload: true });
        };
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <ext:Hidden ID="FormatType" runat="server" />
    <ext:GridPanel 
        ID="GridPanel"
        runat="server" 
        Title="超级管理员总分学生通用分析报表" 
        ColumnLines="true"
        Height="480">
        <Store>
            <ext:Store ID="GridStore" runat="server" OnSubmitData="Store_Submit">
                <Model>
                    <ext:Model runat="server">
                        <Fields>
                            <ext:ModelField Name="StudentID" Type="Int" />
                            <ext:ModelField Name="ClassName" Type="String" />
                            <ext:ModelField Name="StuCode" Type="String" />
                            <ext:ModelField Name="StuName" Type="String" />
                            <ext:ModelField Name="StuType" Type="String" />
                            <ext:ModelField Name="Score" Type="Float" />
                            <ext:ModelField Name="StandardizedScore" Type="Float" />
                            <ext:ModelField Name="RankOfGrade" Type="Int" />
                            <ext:ModelField Name="PercentOfGrade" Type="Float" />
                            <ext:ModelField Name="RankOfClass" Type="Int" />
                            <ext:ModelField Name="PercentOfClass" Type="Float" />
                            <ext:ModelField Name="RankOfClassType" Type="Int" />
                            <ext:ModelField Name="PercentOfClassType" Type="Float" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
        </Store>
        <TopBar>
            <ext:Toolbar runat="server">
                <Items>
                    <ext:Label Text="成绩类别：" runat="server" />
                    <ext:ComboBox ID="TargetType" Text="所有科目" runat="server">
                        <Items>
                            <ext:ListItem Text="所有科目"></ext:ListItem>
                            <ext:ListItem Text="单科科目"></ext:ListItem>
                            <ext:ListItem Text="科目组合"></ext:ListItem>
                            <ext:ListItem Text="科目分卷"></ext:ListItem>
                        </Items>
                        <SelectedItems>
                            <ext:ListItem Text="所有科目"></ext:ListItem>
                        </SelectedItems>
                        <DirectEvents>
                            <Select OnEvent="TargetType_SelectedItemChanged" />
                        </DirectEvents>
                    </ext:ComboBox>
                    <ext:Label Text="选择科目："  runat="server" />
                    <ext:ComboBox 
                        ID="TargetList" 
                        Width="220" 
                        runat="server"
                        DisplayField="Text" 
                        ValueField="Value">
                        <Store>
                            <ext:Store runat="server" ID="TargetStore">
                                <Model>
                                    <ext:Model runat="server" IDProperty="Value">
                                        <Fields>
                                            <ext:ModelField Name="Text" />
                                            <ext:ModelField Name="Value" />
                                            <ext:ModelField Name="Type" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                    </ext:ComboBox>
                    <ext:Label Text="选择班级：" runat="server" />
                    <ext:DropDownField ID="ClassList" Editable="false" runat="server" Text="请选择">
                        <Component>
                            <ext:GridPanel ID="ClassGrid" Width="200" runat="server" ForceFit="true">
                                <Store>
                                    <ext:Store ID="ClassStore" runat="server" GroupField="ClassGrade">
                                        <Model>
                                            <ext:Model runat="server" IDProperty="ClassID">
                                                <Fields>
                                                    <ext:ModelField Name="ClassID" />
                                                    <ext:ModelField Name="ClassCode" />
                                                    <ext:ModelField Name="ClassName" />
                                                    <ext:ModelField Name="ClassType" />
                                                    <ext:ModelField Name="ClassGrade" />
                                                    <ext:ModelField Name="ClassAliasName" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                        <Sorters>
                                            <ext:DataSorter Property="ClassID" Direction="ASC" />
                                        </Sorters>
                                    </ext:Store>                                   
                                </Store>
                                <ColumnModel runat="server">
                                    <Columns>
                                        <ext:Column runat="server" Text="班级" DataIndex="ClassAliasName" />
                                        <ext:Column runat="server" Text="类型" DataIndex="ClassType" />
                                    </Columns>
                                </ColumnModel>
                                <View>
                                    <ext:GridView runat="server" LoadMask="true" />
                                </View>
                                <SelectionModel>
                                    <ext:RowSelectionModel runat="server" Mode="Multi"/>
                                </SelectionModel>
                                <Features>
                                    <ext:Grouping 
                                        runat="server" 
                                        HideGroupedHeader="true" 
                                        StartCollapsed="true" 
                                        GroupHeaderTplString="年级：{name} {rows.length}个班"
                                        />
                                </Features>
                                <Listeners>
                                    <SelectionChange Handler="this.dropDownField.setValue('已选择', false);" />
                                </Listeners>
                            </ext:GridPanel>
                        </Component>
                    </ext:DropDownField>
                    <ext:Button Text="生成" Icon="Accept" runat="server">
                        <DirectEvents>
                            <Click OnEvent="SubmitButton_Click" Timeout="60000"  />
                        </DirectEvents>
                    </ext:Button>
                    <ext:Button Text="保存" AutoPostBack="true" Icon="Disk" runat="server">
                        <Listeners>
                            <Click Handler="submitValue(#{GridPanel}, #{FormatType}, 'xls');" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button Text="打印" Icon="Printer" runat="server">
                        <Listeners>
                            <Click Handler="javascript:window.print();" />
                        </Listeners>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <ColumnModel runat="server">
            <Columns>
                <ext:Column runat="server" Text="班级" DataIndex="ClassName" Flex="1" Sortable="false" />
                <ext:Column runat="server" Text="学号" DataIndex="StuCode" Flex="1" Sortable="false" />
                <ext:Column runat="server" Text="姓名" DataIndex="StuName" Flex="1" Sortable="false" />
                <ext:Column runat="server" Text="类型" DataIndex="StuType" Flex="1" Sortable="false" />
                <ext:Column runat="server" Text="总分、科目组合、各科、分卷">
                    <Columns>
                        <ext:Column runat="server" Text="分数" DataIndex="Score" Sortable="true" />
                        <ext:Column runat="server" Text="标准分" DataIndex="StandardizedScore" Sortable="true" />
                        <ext:Column runat="server" Text="年级排名" DataIndex="RankOfGrade" Sortable="true" />
                        <ext:Column runat="server" Text="年级百分位" DataIndex="PercentOfGrade" Sortable="true">
                            <Renderer Fn="percent" />
                        </ext:Column>
                        <ext:Column runat="server" Text="班级排名" DataIndex="RankOfClass" Sortable="true" />
                        <ext:Column runat="server" Text="班级百分位" DataIndex="PercentOfClass" Sortable="true">
                            <Renderer Fn="percent" />
                        </ext:Column>
                        <ext:Column runat="server" Text="班级类别排名" DataIndex="RankOfClassType" Sortable="true" />
                        <ext:Column runat="server" Text="班级类别百分位" DataIndex="PercentOfClassType" Sortable="true">
                            <Renderer Fn="percent" />
                        </ext:Column>
                    </Columns>
                </ext:Column>
            </Columns>
        </ColumnModel>
        <BottomBar>
            <ext:StatusBar runat="server" Height="150">
                 <LayoutConfig>
                    <ext:HBoxLayoutConfig Align="Stretch" />
                </LayoutConfig>
                <Items>
                    <ext:Chart 
                        ID="Chart1" 
                        runat="server"
                        InsetPadding="25"
                        Flex="1">
                        <AnimateConfig Easing="ElasticIn" Duration="1000" />
                        <Store>
                            <ext:Store 
                                runat="server" 
                                AutoDataBind="true">                           
                                <Model>
                                    <ext:Model runat="server">
                                        <Fields>
                                            <ext:ModelField Name="Text" />
                                            <ext:ModelField Name="Value" />
                                            <ext:ModelField Name="Type" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                        <Axes>
                            <ext:GaugeAxis Minimum="0" Maximum="100" Steps="1" Title="低分率" Margin="-10"  />
                        </Axes>
                        <Series>
                            <ext:GaugeSeries AngleField="Value" Donut="0" ColorSet="#F49D10,#ddd" />
                        </Series>
                    </ext:Chart>
                    <ext:Chart 
                        ID="Chart2" 
                        runat="server"
                        Animate="true"
                        InsetPadding="25"
                        Flex="1">
                        <Store>
                            <ext:Store 
                                runat="server" 
                                AutoDataBind="true">                           
                                <Model>
                                    <ext:Model runat="server">
                                        <Fields>
                                            <ext:ModelField Name="Text" />
                                            <ext:ModelField Name="Value" />
                                            <ext:ModelField Name="Type" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                        <Axes>
                            <ext:GaugeAxis Minimum="0" Maximum="100" Title="及格率" Steps="1" Margin="7" />
                        </Axes>
                        <Series>
                            <ext:GaugeSeries AngleField="Value" Donut="30" ColorSet="#82B525,#ddd" />
                        </Series>
                    </ext:Chart>
                    <ext:Chart 
                        ID="Chart3" 
                        runat="server"
                        InsetPadding="25"
                        Flex="1">
                        <AnimateConfig Easing="BounceOut" Duration="500" />
                        <Store>
                            <ext:Store 
                                runat="server" 
                                AutoDataBind="true">                           
                                <Model>
                                    <ext:Model runat="server">
                                        <Fields>
                                            <ext:ModelField Name="Text" />
                                            <ext:ModelField Name="Value" />
                                            <ext:ModelField Name="Type" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                        <Axes>
                            <ext:GaugeAxis Minimum="0" Maximum="100" Title="优秀率" Steps="1" Margin="7" />
                        </Axes>
                        <Series>
                            <ext:GaugeSeries AngleField="Value" Donut="80" ColorSet="#3AA8CB,#ddd" />
                        </Series>
                    </ext:Chart>
                    <ext:ToolbarFill />
                </Items>
            </ext:StatusBar>
        </BottomBar>
    </ext:GridPanel>
</asp:Content>
